package com.yinNuo.collectWool.utils;


import com.yinNuo.collectWool.core.constant.JwtConstants;

import javax.servlet.http.HttpServletRequest;

/**
* create by: yinNuo
* create at: 2021/12/18 下午4:35
* description: token工具类
*/
public class TokenUtil {

	/**
	 * 根据Authorization获取token
	 */
	public static String getToken(HttpServletRequest request) {
		String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER);
		String authToken = null;
		if (requestHeader != null && requestHeader.startsWith("Bearer ")) {
			authToken = requestHeader.substring(7);
		}
		return authToken;
	}
}
